﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using CommDll;

namespace SupervisionCodeCollection
{
    /// <summary>
    /// ClassName:frmPasswordChange
    /// Version:1.0
    /// Date:2019-05-23
    /// Author:seanouyang
    /// </summary>
    /// <remarks>
    /// 本类是一WinForm 窗体,本窗体主要为确认配送企业
    /// </remarks>    
    public partial class frmSupplierConfirm : DevComponents.DotNetBar.OfficeForm
    {
        #region 01.自定义属性
        public DataTable m_dt = null;   // 数据
        public string  m_strSupplier = "";   // 配送企业
        #endregion

        public frmSupplierConfirm()
        {
            InitializeComponent(); 
        }

        #region 01.系统事件方法
        private void frmSupplierConfirm_Load(object sender, EventArgs e)
        {
            foreach (DataRow dr in m_dt.Rows) {
                lbInfo.Items.Add(dr[0].ToString());
            }         
        }

        private void listBox1_MeasureItem(object sender, MeasureItemEventArgs e)
        {
            this.lbInfo.ItemHeight = 22;
        }

        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            e.DrawFocusRectangle();
            e.Graphics.DrawString(lbInfo.Items[e.Index].ToString(), e.Font, new SolidBrush(Color.Black), e.Bounds);
        }    

        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            //00 数据合法性验证
            if (lbInfo.SelectedIndex >= 0)
            {
                m_strSupplier = lbInfo.Text;
                DialogResult = DialogResult.OK;
            }
        }
        #endregion
    }
}